import sys
import pygame
import cfg

from units.uiUtil import Button

def drawMenus(screen):
    # 画一个按钮，从新开始
    if not cfg.inGame:
        button_1 = Button(screen, (250, 200), '聚宝盆')
        button_2 = Button(screen, (250, 300), '贪吃蛇')
        button_3 = Button(screen, (250, 400), '打飞机')
        button_4 = Button(screen, (250, 500), '打地鼠')
        button_5 = Button(screen, (250, 600), '跳跳龙')
        button_6 = Button(screen, (250, 700), '打砖块')
        button_7 = Button(screen, (250, 800), '消消乐')
        button_8 = Button(screen, (250, 900), '俄罗斯方块')
        button_9 = Button(screen, (250, 1000), '魔塔50层')
        button_10 = Button(screen, (250, 1100), '植物大战僵尸')
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if event.type == pygame.MOUSEBUTTONDOWN:
                if button_1.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "聚宝盆"
                    cfg.inGame = True
                if button_2.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "贪吃蛇"
                    cfg.inGame = True
                if button_3.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "打飞机"
                    cfg.inGame = True
                if button_4.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "打地鼠"
                    cfg.inGame = True
                if button_5.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "跳跳龙"
                    cfg.inGame = True
                if button_6.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "打砖块"
                    cfg.inGame = True
                if button_7.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "消消乐"
                    cfg.inGame = True
                if button_8.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "俄罗斯方块"
                    cfg.inGame = True
                if button_9.collidepoint(pygame.mouse.get_pos()):
                    cfg.concurrentGame = "魔塔50层"
                    cfg.inGame = True